package com.ydl.shopping.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ydl.shopping.domain.TbOrderDetail;
import com.ydl.shopping.mapper.TbOrderDetailMapper;
import com.ydl.shopping.service.ITbOrderDetailService;
import org.springframework.stereotype.Service;

@Service
public class TbOrderDetailServiceImpl extends ServiceImpl<TbOrderDetailMapper, TbOrderDetail> implements ITbOrderDetailService {
    @Override
    public QueryWrapper<TbOrderDetail> queryWrapper(TbOrderDetail entity) {
        QueryWrapper<TbOrderDetail> queryWrapper = new QueryWrapper<>();
        Long userId = entity.getOrderId();
        if (userId != null) {
            queryWrapper.eq("order_id", userId);
        }
        Long goodsId = entity.getGoodsId();
        if (goodsId != null) {
            queryWrapper.eq("goods_id", goodsId);
        }

        return queryWrapper;
    }
}
